package com.year_24;

import java.util.ArrayDeque;
import java.util.Deque;

/**
 *
 * @brief 类简要说明
 *
 * 类详细说明  三月份每日一题（当天写）
 *
 *@author
 *    - 2024/2/29  贾思浩  创建初始版本
 *
 */
public class March_New {

    // 2.29
    // lt 2581 hard
    public int rootCount(int[][] edges, int[][] guesses, int k) {

        return 1;
    }

    // 3.4 easy lc234 用栈实现队列
    class MyQueue {

        private Deque<Integer> inStack;
        private Deque<Integer> outStack;

        public MyQueue() {
            inStack = new ArrayDeque<>();
            outStack = new ArrayDeque<>();
        }

        public void push(int x) {
            inStack.push(x);
        }

        public int pop() {
            while (outStack.isEmpty()) {
                inToOut();
            }
            return outStack.pop();
        }

        public int peek() {
            while (outStack.isEmpty()) {
                inToOut();
            }
            return outStack.peek();
        }

        public boolean empty() {
            return inStack.isEmpty() && outStack.isEmpty();
        }

        private void inToOut() {
            while (!inStack.isEmpty()) {
                outStack.push(inStack.pop());
            }
        }
    }
}
